<!DOCTYPE html>
<!--
     SPDX-License-Identifier: CC-BY-SA-4.0
     SPDX-FileCopyrightText: 2020 seL4 Project a Series of LF Projects, LLC.
-->
<!-- Page last generated 2025-02-20 03:16:15 +0000 -->
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>libsel4vm_guest_vcpu_fault | seL4 docs</title>

    <!-- Our stylesheet and theme stylesheet.  Contains bootstrap. -->
    <link rel="stylesheet" href="/assets/css/style.css" type="text/css">
    <!-- Font awesome -->
    <link href="https://use.fontawesome.com/releases/v5.0.8/css/all.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
    <!-- Pygments syntax highlighting  -->
    <link rel="stylesheet" href="/assets/css/highlighting/trac.css" type="text/css">
    <link rel="icon" type="image/x-icon" href="/assets/favicon.ico"><script defer data-domain="docs.sel4.systems"
	    src="https://analytics.sel4.systems/js/script.js"></script></head>

  <body class="container-fluid">

    



<header>
  <ul class="row menu">
    <li class="col-xs-12 col-md-2" >
            <a href="https://sel4.systems" class="skip-icon">
              <img class="img-responsive" src="/assets/logo-text-white.svg" alt="seL4 logo" />
            </a>
    </li>
    <li class="col-xs-12 col-md-10 menu">
      <nav aria-label="Banner links">
        <h2><a href="/Resources" />Resources</h2>
        <h2><a href="/processes" />Contributing</a></h2>
        <h2><a href="/projects" />Projects</h2>
        <h2><a href="/Tutorials" />Tutorials</h2>
        <iframe title="DuckDuckGo search bar" src="https://duckduckgo.com/search.html?site=docs.sel4.systems&prefill=Search%20sel4.systems" style="overflow:hidden;margin-bottom:10px; padding:0;height:40px;float:right;border-width: 0px"></iframe>
      </nav>
    </li>
  </ul>
  <div class="clear"></div>
  
<div class="breadcrumbs bootstrap hidden-sm-down">
  <nav class="sel-breadcrumb" aria-label="Breadcrumb" >
    <ol class=" list-unstyled" vocab="http://schema.org/" typeof="BreadcrumbList">
      
      
        

        

        <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
            <a property="item" typeof="WebPage" href="/">
              <span property="name"><b>seL4 Docs</b></span>
            </a>
            <meta property="position" content="1" />
        </li>
      
        

        

        <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
            <a property="item" typeof="WebPage" href="/projects/">
              <span property="name"><b>Projects</b></span>
            </a>
            <meta property="position" content="2" />
        </li>
      
        

        

        <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
            <a property="item" typeof="WebPage" href="/projects/virtualization/">
              <span property="name"><b>Virtualisation on seL4</b></span>
            </a>
            <meta property="position" content="3" />
        </li>
      
        

        

        <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
            <a property="item" typeof="WebPage" href="/projects/virtualization/docs/">
              <span property="name"><b>libsel4vm & libsel4vmmplatsupport API documentation</b></span>
            </a>
            <meta property="position" content="4" />
        </li>
      
        

        
          <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
            <span property="name">libsel4vm_guest_vcpu_fault</span>
            <meta property="position" content="5" /></li>
          
    </ol>
  </nav>
  <nav class="sel-version" aria-label="Current Versions">
    <ol class="list-unstyled">
      <li class="list-unstyled text-right" style="margin-left:auto; padding:0rem 0rem;">
        Current versions:</li>
      <li class="list-unstyled text-right">
      <a href="/releases/sel4/13.0.0"><b>seL4-13.0.0</b></a></li>
      <li class="list-unstyled text-right">
      <a href="/releases/microkit/1.4.1"><b>microkit-1.4.1</b></a></li>
      <li class="list-unstyled text-right">
      <a href="/releases/camkes/camkes-3.11.0"><b>camkes-3.11.0</b></a></li>
      <li class="list-unstyled text-right">
      <a href="/releases/capdl/0.3.0"><b>capDL-0.3.0</b></a></li>
      </ol>
  </nav>
  <div class='clear'></div>
</div>


</header>

    <main>
      <div class="row">
  <div class="hidden-xs col-sm-4 col-md-3 col-lg-2">
    


<div class="sidebar">















    <ul class="nav nav-sidebar">
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4/">seL4</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/l4v/">L4.verified</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/camkes/">CAmkES</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/capdl/">CapDL</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/elfloader/">Elfloader</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/buildsystem/">seL4 Buildsystem</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/user_libs/">user_libs</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4runtime/">The seL4 run-time</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4webserver/">seL4webserver</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4-tutorials/">seL4 tutorials</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4bench/">sel4bench</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4test/">seL4Test</a>
        </li>
  
    
    

    
        <li class="active">
            <a class="" href="/projects/virtualization/">Virtualization</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/camkes-vm/">camkes-vm</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/dockerfiles/">Dockerfiles</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/docsite/">seL4 Documentation website</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4_tools/">seL4_tools</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/microkit/">Microkit</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/hardware_hacks/">Hardware Hacks</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/rust/">Rust</a>
        </li>
  
    </ul>


</div>

  </div>
  <div class="content col-sm-8 col-md-6 col-lg-7 main">
    <!--
     Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)

     SPDX-License-Identifier: CC-BY-SA-4.0
-->

<h2 id="interface-guest_vcpu_faulth">Interface <code class="language-plaintext highlighter-rouge">guest_vcpu_fault.h</code></h2>

<p>The libsel4vm VCPU fault interface provides a set of useful methods to query and configure vcpu objects that
have faulted during execution. This interface is commonly leveraged by VMM’s to process a vcpu fault and handle
it accordingly.</p>

<h3 id="brief-content">Brief content:</h3>

<p><strong>Functions</strong>:</p>

<blockquote>
  <p><a href="#function-get_vcpu_fault_addressvcpu"><code class="language-plaintext highlighter-rouge">get_vcpu_fault_address(vcpu)</code></a></p>
</blockquote>

<blockquote>
  <p><a href="#function-get_vcpu_fault_ipvcpu"><code class="language-plaintext highlighter-rouge">get_vcpu_fault_ip(vcpu)</code></a></p>
</blockquote>

<blockquote>
  <p><a href="#function-get_vcpu_fault_datavcpu"><code class="language-plaintext highlighter-rouge">get_vcpu_fault_data(vcpu)</code></a></p>
</blockquote>

<blockquote>
  <p><a href="#function-get_vcpu_fault_data_maskvcpu"><code class="language-plaintext highlighter-rouge">get_vcpu_fault_data_mask(vcpu)</code></a></p>
</blockquote>

<blockquote>
  <p><a href="#function-get_vcpu_fault_sizevcpu"><code class="language-plaintext highlighter-rouge">get_vcpu_fault_size(vcpu)</code></a></p>
</blockquote>

<blockquote>
  <p><a href="#function-is_vcpu_read_faultvcpu"><code class="language-plaintext highlighter-rouge">is_vcpu_read_fault(vcpu)</code></a></p>
</blockquote>

<blockquote>
  <p><a href="#function-set_vcpu_fault_datavcpu-data"><code class="language-plaintext highlighter-rouge">set_vcpu_fault_data(vcpu, data)</code></a></p>
</blockquote>

<blockquote>
  <p><a href="#function-emulate_vcpu_faultvcpu-data"><code class="language-plaintext highlighter-rouge">emulate_vcpu_fault(vcpu, data)</code></a></p>
</blockquote>

<blockquote>
  <p><a href="#function-advance_vcpu_faultvcpu"><code class="language-plaintext highlighter-rouge">advance_vcpu_fault(vcpu)</code></a></p>
</blockquote>

<blockquote>
  <p><a href="#function-restart_vcpu_faultvcpu"><code class="language-plaintext highlighter-rouge">restart_vcpu_fault(vcpu)</code></a></p>
</blockquote>

<h2 id="functions">Functions</h2>

<p>The interface <code class="language-plaintext highlighter-rouge">guest_vcpu_fault.h</code> defines the following functions.</p>

<h3 id="function-get_vcpu_fault_addressvcpu">Function <code class="language-plaintext highlighter-rouge">get_vcpu_fault_address(vcpu)</code></h3>

<p>Get current fault address of vcpu</p>

<p><strong>Parameters:</strong></p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">vcpu {vm_vcpu_t *}</code>: Handle to vcpu</li>
</ul>

<p><strong>Returns:</strong></p>

<ul>
  <li>Current fault address of vcpu</li>
</ul>

<p>Back to <a href="#module-guest_vcpu_faulth">interface description</a>.</p>

<h3 id="function-get_vcpu_fault_ipvcpu">Function <code class="language-plaintext highlighter-rouge">get_vcpu_fault_ip(vcpu)</code></h3>

<p>Get instruction pointer of current vcpu fault</p>

<p><strong>Parameters:</strong></p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">vcpu {vm_vcpu_t *}</code>: Handle to vcpu</li>
</ul>

<p><strong>Returns:</strong></p>

<ul>
  <li>Intruction pointer of vcpu fault</li>
</ul>

<p>Back to <a href="#module-guest_vcpu_faulth">interface description</a>.</p>

<h3 id="function-get_vcpu_fault_datavcpu">Function <code class="language-plaintext highlighter-rouge">get_vcpu_fault_data(vcpu)</code></h3>

<p>Get the data of the current vcpu fault</p>

<p><strong>Parameters:</strong></p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">vcpu {vm_vcpu_t *}</code>: Handle to vcpu</li>
</ul>

<p><strong>Returns:</strong></p>

<ul>
  <li>Data of vcpu fault</li>
</ul>

<p>Back to <a href="#module-guest_vcpu_faulth">interface description</a>.</p>

<h3 id="function-get_vcpu_fault_data_maskvcpu">Function <code class="language-plaintext highlighter-rouge">get_vcpu_fault_data_mask(vcpu)</code></h3>

<p>Get data mask of the current vcpu fault</p>

<p><strong>Parameters:</strong></p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">vcpu {vm_vcpu_t *}</code>: Handle to vcpu</li>
</ul>

<p><strong>Returns:</strong></p>

<ul>
  <li>Data mask of vcpu fault</li>
</ul>

<p>Back to <a href="#module-guest_vcpu_faulth">interface description</a>.</p>

<h3 id="function-get_vcpu_fault_sizevcpu">Function <code class="language-plaintext highlighter-rouge">get_vcpu_fault_size(vcpu)</code></h3>

<p>Get access size of the current vcpu fault</p>

<p><strong>Parameters:</strong></p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">vcpu {vm_vcpu_t *}</code>: Handle to vcpu</li>
</ul>

<p><strong>Returns:</strong></p>

<ul>
  <li>Access size of vcpu fault</li>
</ul>

<p>Back to <a href="#module-guest_vcpu_faulth">interface description</a>.</p>

<h3 id="function-is_vcpu_read_faultvcpu">Function <code class="language-plaintext highlighter-rouge">is_vcpu_read_fault(vcpu)</code></h3>

<p>Is current vcpu fault a read fault</p>

<p><strong>Parameters:</strong></p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">vcpu {vm_vcpu_t *}</code>: Handle to vcpu</li>
</ul>

<p><strong>Returns:</strong></p>

<ul>
  <li>True if read fault, False if write fault</li>
</ul>

<p>Back to <a href="#module-guest_vcpu_faulth">interface description</a>.</p>

<h3 id="function-set_vcpu_fault_datavcpu-data">Function <code class="language-plaintext highlighter-rouge">set_vcpu_fault_data(vcpu, data)</code></h3>

<p>Set the data of the current vcpu fault</p>

<p><strong>Parameters:</strong></p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">vcpu {vm_vcpu_t *}</code>: Handle to vcpu</li>
  <li><code class="language-plaintext highlighter-rouge">data {seL4_Word}</code>: Data to set for current vcpu fault</li>
</ul>

<p><strong>Returns:</strong></p>

<ul>
  <li>0 for success, otherwise -1 for error</li>
</ul>

<p>Back to <a href="#module-guest_vcpu_faulth">interface description</a>.</p>

<h3 id="function-emulate_vcpu_faultvcpu-data">Function <code class="language-plaintext highlighter-rouge">emulate_vcpu_fault(vcpu, data)</code></h3>

<p>Emulate a read or write fault on a given data value</p>

<p><strong>Parameters:</strong></p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">vcpu {vm_vcpu_t *}</code>: Handle to vcpu</li>
  <li><code class="language-plaintext highlighter-rouge">data {seL4_Word}</code>: Data to perform emulate fault on</li>
</ul>

<p><strong>Returns:</strong></p>

<ul>
  <li>Emulation result of vcpu fault over given data value</li>
</ul>

<p>Back to <a href="#module-guest_vcpu_faulth">interface description</a>.</p>

<h3 id="function-advance_vcpu_faultvcpu">Function <code class="language-plaintext highlighter-rouge">advance_vcpu_fault(vcpu)</code></h3>

<p>Advance the current vcpu fault to the next stage/instruction</p>

<p><strong>Parameters:</strong></p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">vcpu {vm_vcpu_t *}</code>: Handle to vcpu</li>
</ul>

<p><strong>Returns:</strong></p>

<p>No return</p>

<p>Back to <a href="#module-guest_vcpu_faulth">interface description</a>.</p>

<h3 id="function-restart_vcpu_faultvcpu">Function <code class="language-plaintext highlighter-rouge">restart_vcpu_fault(vcpu)</code></h3>

<p>Restart the current vcpu fault</p>

<p><strong>Parameters:</strong></p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">vcpu {vm_vcpu_t *}</code>: Handle to vcpu</li>
</ul>

<p><strong>Returns:</strong></p>

<p>No return</p>

<p>Back to <a href="#module-guest_vcpu_faulth">interface description</a>.</p>

<p>Back to <a href="#">top</a>.</p>


  </div>







  
  
<div class="sidebar-toc hidden-xs hidden-sm col-md-3 col-lg-3">
  
    <ul class="section-nav">
    	<h2> Virtualization </h2> 
        <li>
          
          <a style="" class="" href="/projects/virtualization/">
            Documentation homepage
          </a>
        </li>

















    
        <h3>Repositories</h3>
    
        <li>
          <a class="" href="https://github.com/seL4proj/seL4_projects_libs">
            seL4_projects_libs
          </a>
        </li>









  







    </ul>

</div>


</div>

    </main>
    


<footer class="site-footer">

  <h2 class="footer-heading">seL4 docs</h2>

  <div class="footer-col-wrapper">

    <div class="col-md-2">
      



<ul class="social-media-list">
  <li><a href="https://github.com/sel4"><i class="fab fa-github"></i> <span class="username">sel4</span></a></li><li><a href="https://github.com/sel4proj"><i class="fab fa-github"></i> <span class="username">sel4proj</span></a></li>
</ul>

    </div>

    <div class="col-md-8">
      <ul class="list-unstyled">
        <li>
          This site is for displaying seL4 related documentation.  Pull requests are welcome.
        </li>
        
          <li>
            Site last updated: Fri Feb 7 10:17:38 2025 +1100 ee78c8857c
          </li>
          <li>
                Page last updated: 
          </li>
        
      </ul>
    </div>
    <div class="col-md-2">
<a href="https://github.com/seL4/docs/blob/master/projects/virtualization/docs/api/libsel4vm_guest_vcpu_fault.md">View page on GitHub</a>
      <br />
      <a href="https://github.com/seL4/docs/edit/master/projects/virtualization/docs/api/libsel4vm_guest_vcpu_fault.md">Edit page on GitHub</a>
      <br />
      <a href="/sitemap">Sitemap</a>
    </div>

  </div>

</footer>

  </body>
</html>
